import axios  from 'axios'
import nprogress from 'nprogress'
import "nprogress/nprogress.css"

export const requestMock = axios.create({
    baseURL: process.env.VUE_APP_MOCK,
    timeout: 10000
})

requestMock.interceptors.request.use((config) => {
    nprogress.start()
    return config

}, (error) => {
    nprogress.done()
    return Promise.reject(error.message)
})

requestMock.interceptors.response.use((response) => {
    // console.log(response.data.data);
    nprogress.done()
    return response.data.data

}, (error) => {
    nprogress.done()
    Promise.reject(error.message)
})